package com.hyk.commonLib.common.utils.dataBinding.bindingAdapter;

import androidx.databinding.BindingAdapter;

import com.haibin.calendarview.CalendarView;

/**
 * @see com.haibin.calendarview.CalendarView
 */
public class CalenderViewAdapter {

    @BindingAdapter(value = {"year", "monthOfYear", "dayOfMonth"}, requireAll = false)
    public static void setEditorActions(CalendarView view, Integer year, Integer monthOfYear, Integer dayOfMonth) {
        if (year == null) {
            year = view.getCurYear();
        }
        if (monthOfYear == null) {
            monthOfYear = view.getCurMonth();
        }
        if (dayOfMonth == null) {
            dayOfMonth = view.getCurDay();
        }
        view.scrollToCalendar(year, monthOfYear, dayOfMonth);
    }
}
